﻿using System.ComponentModel;
using System.IO;
using Zeta.Common.Xml;
using Zeta.XmlEngine;

namespace IncubusCC.Settings
{
    [XmlElement("IncubusCCSettings")]
    internal class IncubusCCSettings : XmlSettings
    {
        public IncubusCCSettings() :
            base(Path.Combine(Path.Combine(SettingsDirectory, "IncubusCC"), "IncubusCCSettings.xml"))
        {
        }

        private static IncubusCCSettings _instance;

        public static IncubusCCSettings Instance { get { return _instance ?? (_instance = new IncubusCCSettings()); } }

        [XmlElement("HealthPotionPct")]
        [DisplayName("Health Potion %")]
        [Category("Common")]
        [Description("Health % to use Health Potions")]
        [DefaultValue(0.4)]
        public double HealthPotionPct { get; set; }

        [XmlElement("MoveToHealthGlobe")]
        [DefaultValue(true)]
        public bool GetHealthGlobe { get; set; }

        [XmlElement("HealthGlobeHP")]
        [DefaultValue(0.5)]
        public double HealthGlobeHP { get; set; }

        [XmlElement("HealthGlobeDistance")]
        [DefaultValue(15)]
        public float HealthGlobeDistance { get; set; }

        #region Class Late-Loading Wrappers
        private BarbarianSettings _barbSettings;
        private DemonHunterSettings _dhSettings;
        private MonkSettings _monkSettings;
        private WitchDoctorSettings _wdSettings;
        private WizardSettings _wizSettings;

        [Browsable(false)]
        public BarbarianSettings Barbarain { get { return _barbSettings ?? (_barbSettings = new BarbarianSettings()); } }

        [Browsable(false)]
        public DemonHunterSettings DemonHunter { get { return _dhSettings ?? (_dhSettings = new DemonHunterSettings()); } }

        [Browsable(false)]
        public MonkSettings Monk { get { return _monkSettings ?? (_monkSettings = new MonkSettings()); } }

        [Browsable(false)]
        public WitchDoctorSettings WitchDoctor { get { return _wdSettings ?? (_wdSettings = new WitchDoctorSettings()); } }

        [Browsable(false)]
        public WizardSettings Wizard { get { return _wizSettings ?? (_wizSettings = new WizardSettings()); } }
        #endregion
    }
}
